<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Menu extends Model
{
	/**
	 * 定义属性类型
	 *
	 * @var array
	 * Date: 2018/1/28
	 * @author George
	 */
	protected $casts = [
		'meta' => 'json'
	];

	/**
	 * 定义不可填充字段
	 *
	 * @var array
	 * Date: 2018/1/28
	 * @author George
	 */
	protected $guarded = ['id'];

    /**
     * 获取菜单对应的权限信息
     *
     * Date: 2018/1/26
     * @author George
     * @return \Illuminate\Database\Eloquent\Relations\MorphOne
     */
    public function permissions()
    {
        return $this->morphOne(Permission::class, 'permissiontable');
    }
}
